<?php

class Login extends Controller {

	function Login(){
		parent::Controller();	
	}	
	function index(){				
		$this->_loadview();
	}
	function check(){
		$this->load->model('login_model');
		if($this->login_model->checklogin()){			
			redirect('/cpanel/','location');
		}
		else{			
			$this->_loadview($this->login_model->username,$this->login_model->errmsg);			
		}
	}	
	function _loadview($username='',$errmsg=''){
		delete_cookie("username_admin");
		$data = $this->common_model->general();
		$data['username'] = $username;
		$data['errMsg'] = $errmsg;		
		$data['bodyview'] = 'login';			
		$this->load->view('mastertemplate',$data);
	}
}

/* End of file login.php */
/* Location: ./system/application/admin/controllers/login.php */